import java.util.HashMap;
import java.util.List;
import java.util.Map;
import weaver.conn.RecordSet;
import weaver.general.Util;
import weaver.hrm.User;
import weaver.rdeploy.workflow.WorkflowInitialization;
import weaver.systeminfo.SysMaintenanceLog;
import weaver.systeminfo.SystemEnv;
import weaver.workflow.workflow.WFNodeMainManager;
import weaver.workflow.workflow.WorkflowComInfo;
import weaver.workflow.workflow.WorkflowVersion;
import com.engine.common.biz.AbstractCommonCommand;
import com.engine.common.biz.SimpleBizLogger;
import com.engine.common.constant.BizLogSmallType4Workflow;
import com.engine.common.constant.BizLogType;
import com.engine.common.constant.ParamConstant;
import com.engine.common.entity.BizLogContext;
import com.engine.core.interceptor.CommandContext;
public class DoSaveNodeCmd extends AbstractCommonCommand<Map<String, Object>>{
    private SimpleBizLogger logger;
    public DoSaveNodeCmd(Map<String, Object> params,User user) {
        this.params = params;
        this.user = user;
        this.logger = new SimpleBizLogger();
    }
    public DoSaveNodeCmd() {
    }
    @Override
    public BizLogContext getLogContext() {
    return null;
    }
    @Override
    public List<BizLogContext> getLogContexts() {
    return logger.getBizLogContexts();
    }
    public void bofore(){
        WorkflowComInfo WorkflowComInfo = new WorkflowComInfo();
        BizLogContext bizLogContext = new BizLogContext();
        bizLogContext.setLogType(BizLogType.WORKFLOW_ENGINE);
        bizLogContext.setBelongType(BizLogSmallType4Workflow.WORKFLOW_ENGINE_PATH);//所属大类型
        bizLogContext.setBelongTypeTargetId(Util.null2String(params.get("workflowId")));//所属大类型id
        bizLogContext.setBelongTypeTargetName(WorkflowComInfo.getWorkflowname(Util.null2String(params.get("workflowId"))));//所属大名称
        bizLogContext.setLogSmallType(BizLogSmallType4Workflow.WORKFLOW_ENGINE_PATH_PATHSET_NODESET);//当前小类型
        logger.setUser(user);//当前操作人
        logger.setParams(params);//request请求参数
        String mainSql ="select f.nodeid, n.nodename,f.nodetype,n.nodeattribute,n.passnum from workflow_flownode f inner join workflow_nodebase n on f.nodeid = n.id where f.workflowid = " + Util.getIntValue(Util.null2String(params.get("workflowId")));
        logger.setMainSql(mainSql,"nodeid");
        logger.setMainTargetNameColumn("nodename");
        logger.setMainTargetNameMethod(this.getClass().getName() + ".getMethod", "column:nodename+column:nodeattribute+" + user.getLanguage());
        logger.before(bizLogContext);
    }
    public String getMethod(String targetid,String para){
        return "1";
    }
    @Override
    public Map<String, Object> execute(CommandContext commandContext) {
        //日志记录
        this.bofore();
        return doSaveNodeInfo();
    }
    public Map<String, Object> doSaveNodeInfo(){
        //...业务代码
        return apidatas;
    }
}
